'use strict';

// import myaxios from ("axios")
const myaxios = require("axios")
const Controller = require('egg').Controller;

class rootController extends Controller {
	//查询数据
	async userinfo() {
		let res = `select * from user`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}
	async useraccountall() {
		let res = `select * from user_account`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}
	async carall() {
		let res = `select * from user_car`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}
	async dingdanall() {
		let res = `select * from user_indent`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}
	async tezheng() {
		let res = `select * from user_trait`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}
	async details_page() {
		let res = `select * from details_page`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}
	async details_img() {
		let res = `select * from details_img`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}

    //增加
    async goods() {
        let value=this.ctx.request.query.value
		let res = `insert into goods (goods_name,goods_taste,goods_english,goods_price,goods_label,goods_sort,goods_coverimg,goods_scene) values ('${value}','${value}','${value}''${value}','${value}','${value}','${value}','${value}')`
        let ansor = await this.app.mysql.query(res)
        this.ctx.body=ansor
	}

	//删除数据
	async cmtde(){
		let c=this.ctx.query.time
		console.log(c);
		let res = ` DELETE FROM goods_comment WHERE TIME= "${c}" `
        let ansor = await this.app.mysql.query(res)
		this.ctx.body=ansor
	}

	


}



module.exports = rootController;
